package com.david.func_test.animinter

import android.view.animation.BaseInterpolator

class CustomBounceInterpolator: BaseInterpolator() {

    private fun bounce(t: Float): Float {
        return t* (3.5f-2.5f*t)//为-2.5*x*x+3.5*x曲线，效果参考：http://inloop.github.io/interpolator/
    }


    override fun getInterpolation(t: Float): Float {
        // _b(t) = t * t * 8
        // bs(t) = _b(t) for t < 0.3535
        // bs(t) = _b(t - 0.54719) + 0.7 for t < 0.7408
        // bs(t) = _b(t - 0.8526) + 0.9 for t < 0.9644
        // bs(t) = _b(t - 1.0435) + 0.95 for t <= 1.0
        // b(t) = bs(t * 1.1226)
        return bounce(t)
    }
}